package com.xjoyt.pay.master.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import com.xjoyt.pay.master.dao.MerchantRepositoryCustom;
import com.xjoyt.pay.master.po.Merchant;
import com.xjoyt.pay.repository.Repository;

public interface MerchantRepository extends Repository<Merchant>, MerchantRepositoryCustom {

	Page<Merchant> findAllByNoOrPhone(String account, Pageable pageable);

	Page<Merchant> findAllByNo(String no, Pageable pageable);

	Page<Merchant> findAllByDistributorIdAndOutNo(String distributorId, String outNo, Pageable pageable);

	@Query(" select a from Merchant a where a.distributor.company.id = ?1 or a.distributor.company.path like ?2 ")
	List<Merchant> findAllByCompanyIdOrCompanyPathLike(String companyId, String path);

}
